import requests
import json

def callMeizi( ):
    url="https://gank.io/api/v2/data/category/Girl/type/Girl/page/1/count/10"
    headers={'Content-type':'application/json'}
    res=requests.get(url,headers=headers)
    print(res.json())

BASE_URL="http://172.28.2.106:8088"
def login(account,pwd,postHandler):
    url=BASE_URL+"/api/v1/cms/login"
    headers={'Content-Type':'application/json'}
    dict={}
    dict['account']=account
    dict['credential']=pwd
    res= requests.post(url,data=json.dumps(dict),headers=headers)
    print(res.text)
    resjson=res.json()
    token=resjson['accessToken']
    print(token)
    postHandler(token)

def queryAllData(token):
    url=BASE_URL+"/api/v1/cms/hierarchies"
    headers={'Content-Type':'application/json','Authorization':token}
    res=requests.get(url,headers=headers)
    print(res.json())
login("admin@fatri.cn","Aa1234567890-",queryAllData)

